package com.guisu.material.recyclerview.custom

import android.view.View
import java.util.Stack

// 回收池  存<---->取   type作为id
class Recycler(count: Int) {
    private val mCount = count
    private val views by lazy { Array<Stack<View>>(count){ Stack() } }

    fun getRecyclerView(type: Int): View? {
        return try {
            views[type].pop()
        } catch (e: Exception) {
            null
        }
    }

    fun addRecyclerView(view: View, type: Int) {
        views[type].push(view)
    }
}